package com.gx.ObserverPattern.java;

import java.util.Observable;


/**
 * Created by gx on 2017/3/1.
 */
public class WeatherData extends Observable {


    private float temperature;
    private float humidity;
    private float pressure;
    public WeatherData() {

    }

    public float getTemperature() {
        return temperature;
    }

    public void setTemperature(float temperature) {
        this.temperature = temperature;
    }

    public float getHumidity() {
        return humidity;
    }

    public void setHumidity(float humidity) {
        this.humidity = humidity;
    }

    public float getPressure() {
        return pressure;
    }

    public void setPressure(float pressure) {
        this.pressure = pressure;
    }

    public void measurementsChanged() {
        setChanged();
        notifyObservers();
    }


    public void setMeasurements(float temperature,float humidity,float pressure){
        this.pressure=pressure;
        this.humidity=humidity;
        this.temperature=temperature;
        measurementsChanged();
    }

}
